# SPDX-License-Identifier: GPL-2.0

#
# This file is part of Lustre, http://www.lustre.org/
#

MODULES := ptlrpc
ptlrpc_dir := $(dir $(lastword $(MAKEFILE_LIST)))
LDLM := @top_srcdir@/lustre/ldlm/
TARGET := @top_srcdir@/lustre/target/

ptlrpc_objs := client.o recover.o connection.o niobuf.o pack_generic.o
ptlrpc_objs += events.o ptlrpc_module.o service.o pinger.o
ptlrpc_objs += llog_net.o llog_client.o import.o ptlrpcd.o
ptlrpc_objs += pers.o lproc_ptlrpc.o wiretest.o layout.o
ptlrpc_objs += sec.o sec_ctx.o sec_gc.o sec_config.o sec_lproc.o
ptlrpc_objs += sec_null.o sec_plain.o nrs.o nrs_fifo.o nrs_delay.o heap.o
ptlrpc_objs += errno.o batch.o

nrs_server_objs := nrs_crr.o nrs_orr.o nrs_tbf.o

nodemap_objs := nodemap_handler.o nodemap_lproc.o nodemap_range.o
nodemap_objs += nodemap_idmap.o nodemap_member.o nodemap_storage.o
nodemap_objs += nodemap_fileset_alt.o

-include $(ptlrpc_dir)/../ldlm/Makefile
@SERVER_TRUE@-include $(ptlrpc_dir)/../target/Makefile

ptlrpc-objs := $(ptlrpc_objs)
ptlrpc-objs += $(patsubst %,$(LDLM)%,$(ldlm_objs))
@SERVER_TRUE@ptlrpc-objs += $(nodemap_objs) $(nrs_server_objs)
@SERVER_TRUE@ptlrpc-objs += pack_server.o llog_server.o
@SERVER_TRUE@ptlrpc-objs += $(patsubst %,$(TARGET)%,$(target_objs))

@GSS_TRUE@obj-m += gss/

default: all

EXTRA_DIST := $(ptlrpc_objs:.o=.c) ptlrpc_internal.h
EXTRA_DIST += $(nodemap_objs:.o=.c) nodemap_internal.h heap.h
EXTRA_DIST += $(nrs_server_objs:.o=.c)
EXTRA_DIST += pack_server.c
EXTRA_DIST += llog_server.c

EXTRA_PRE_CFLAGS := -I@LUSTRE@/ldlm -I@LUSTRE@/target

@INCLUDE_RULES@
